/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

package com.huawei.saashousekeeper.properties;

import com.huawei.saashousekeeper.dbpool.PoolConfig;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;

import java.util.Map;

/**
 * 动态数据源配置属性
 *
 * @author lWX1156935
 * @since 2022/4/22
 */
@ConfigurationProperties(prefix = DynamicSourceProperties.PREFIX)
@Data
@RefreshScope
public class DynamicSourceProperties extends PoolConfig {

    public static final String PREFIX = "spring.datasource.dynamic";

    /**
     * 是否开启配置
     */
    private boolean enable;

    /**
     * 默认源
     */
    private String defaultSource;

    /**
     * 数据源及其配置 key = groupName
     */
    private Map<String, MasterSlaveProperty> dataSourceMap;

    /**
     * 租户与数据源绑定关系
     */
    private Map<String, DataSourceBindingProperty> bindingMap;
}
